#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
#include<queue>
#include<stack>
using namespace std;
void solve() {
	long long n;
	cin >> n;
	vector<long long>x(n), y(n);
	for (int i = 0; i < n; i++)cin >> x[i] >> y[i];
	long long res = 0, sumx = 0, sumy = 0;
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	for (int i = 0; i < n; i++) {
		res += i * x[i] - sumx;
		res += i * y[i] - sumy;
		sumx += x[i];
		sumy += y[i];
	}
	cout << res << "\n";
}
int main()
{
	solve();
	return 0;
}